@echo off
setlocal enabledelayedexpansion

rem 设置 APP_NAME
set APP_NAME=nb-shenyu-admin

rem 定义 ENV 数组
set ENVS=qa prd-wg

rem 遍历 ENV 数组
for %%E in (%ENVS%) do (
    set ENV=%%E
    set CONFIGMAP_NAME=!APP_NAME!-cloud-properties-configmap-!ENV!

    rem 删除 configmap
    kubectl delete configmap !CONFIGMAP_NAME!

    rem 创建 configmap
    kubectl create configmap !CONFIGMAP_NAME! --from-file=config=src/main/resources/application-!ENV!.yml

    rem 导出 configmap
    kubectl get configmap !CONFIGMAP_NAME! -o yaml > templates/configMap_!ENV!.yaml
)

endlocal